$this->maxDifferences = ceil( ( $this->m + $this->n ) / 2.0 );
if ( $this->m * $this->n > $this->tooLong ) {
// limit complexity to D^POW_LIMIT for long sequences
- $this->maxDifferences = floor( pow( $this->maxDifferences, $this->powLimit - 1.0 ) );
+ $this->maxDifferences = floor( $this->maxDifferences ** ( $this->powLimit - 1.0 ) );
wfDebug( "Limiting max number of differences to $this->maxDifferences\n" );
}
$ip = self::sanitizeIP( $ip );
$n = ip2long( $ip );
if ( $n < 0 ) {
- $n += pow( 2, 32 );
+ $n += 2 ** 32;
# On 32-bit platforms (and on Windows), 2^32 does not fit into an int,
# so $n becomes a float. We convert it to string instead.
if ( is_float( $n ) ) {
}
# Convert to unsigned
if ( $network < 0 ) {
- $network += pow( 2, 32 );
+ $network += 2 ** 32;
}
} else {
$network = false;
$start = $end = false;
} else {
$start = sprintf( '%08X', $network );
- $end = sprintf( '%08X', $network + pow( 2, ( 32 - $bits ) ) - 1 );
+ $end = sprintf( '%08X', $network + 2 ** ( 32 - $bits ) - 1 );
}
// Explicit range
} elseif ( strpos( $range, '-' ) !== false ) {
$shards = [];
list( $digits, $base ) = $this->getContainerHashLevels( $container );
if ( $digits > 0 ) {
- $numShards = pow( $base, $digits );
+ $numShards = $base ** $digits;
for ( $index = 0; $index < $numShards; $index++ ) {
$shards[] = '.' . Wikimedia\base_convert( $index, 10, $base, $digits );
}
}
}
if ( is_numeric( $val ) ) {
- $fNumber = pow( 2, $val / 2 );
+ $fNumber = 2 ** ( $val / 2 );
if ( $fNumber !== false ) {
$val = $this->msg( 'exif-maxaperturevalue-value',
$this->formatNum( $val ),
*/
static function readGCT( $fh, $bpp ) {
if ( $bpp > 0 ) {
- $max = pow( 2, $bpp );
+ $max = 2 ** $bpp;
for ( $i = 1; $i <= $max; ++$i ) {
fread( $fh, 3 );
}
// Write back the new counter value
ftruncate( $handle, 0 );
rewind( $handle );
- fwrite( $handle, fmod( $counter, pow( 2, 48 ) ) ); // warp-around as needed
+ fwrite( $handle, fmod( $counter, 2 ** 48 ) ); // warp-around as needed
fflush( $handle );
// Release the UID lock file
flock( $handle, LOCK_UN );
}
$ids = [];
- $divisor = pow( 2, $bits );
+ $divisor = 2 ** $bits;
$currentId = floor( $counter - $count ); // pre-increment counter value
for ( $i = 0; $i < $count; ++$i ) {
$ids[] = fmod( ++$currentId, $divisor );
protected function millisecondsSinceEpochBinary( array $time ) {
list( $sec, $msec ) = $time;
$ts = 1000 * $sec + $msec;
- if ( $ts > pow( 2, 52 ) ) {
+ if ( $ts > 2 ** 52 ) {
throw new RuntimeException( __METHOD__ .
': sorry, this function doesn\'t work after the year 144680' );
}
$offset = '122192928000000000';
if ( PHP_INT_SIZE >= 8 ) { // 64 bit integers
$ts = ( 1000 * $sec + $msec ) * 10000 + (int)$offset + $delta;
- $id_bin = str_pad( decbin( $ts % pow( 2, 60 ) ), 60, '0', STR_PAD_LEFT );
+ $id_bin = str_pad( decbin( $ts % ( 2 ** 60 ) ), 60, '0', STR_PAD_LEFT );
} elseif ( extension_loaded( 'gmp' ) ) {
$ts = gmp_add( gmp_mul( (string)$sec, '1000' ), (string)$msec ); // ms
$ts = gmp_add( gmp_mul( $ts, '10000' ), $offset ); // 100ns intervals
}
// Throw an exception if there was loss of precision
- if ( $value > pow( 2, 52 ) ) {
+ if ( $value > 2 ** 52 ) {
$this->error( 'zip-unsupported', 'number too large to be stored in a double. ' .
'This could happen if we tried to unpack a 64-bit structure ' .
'at an invalid location.' );
public function execute() {
$this->setNamespacePriorities();
$this->url_limit = 50000;
- $this->size_limit = pow( 2, 20 ) * 10;
+ $this->size_limit = ( 2 ** 20 ) * 10;
# Create directory if needed
$fspath = $this->getOption( 'fspath', getcwd() );
exit( 1 );
}
- $binSize = intval( pow( 10, floor( log10( $endId ) ) - 3 ) );
+ $binSize = intval( 10 ** ( floor( log10( $endId ) ) - 3 ) );
if ( $binSize < 100 ) {
$binSize = 100;
}
$spec['height'] = mt_rand( $this->minHeight, $this->maxHeight );
$spec['fill'] = $this->getRandomColor();
- $diagonalLength = sqrt( pow( $spec['width'], 2 ) + pow( $spec['height'], 2 ) );
+ $diagonalLength = sqrt( $spec['width'] ** 2 + $spec['height'] ** 2 );
$draws = [];
for ( $i = 0; $i <= $this->shapesToDraw; $i++ ) {
"1 gigabyte"
],
[
- pow( 1024, 4 ),
+ 1024 ** 4,
"1 TB",
"1 terabyte"
],
[
- pow( 1024, 5 ),
+ 1024 ** 5,
"1 PB",
"1 petabyte"
],
[
- pow( 1024, 6 ),
+ 1024 ** 6,
"1 EB",
"1,024 exabyte"
],
[
- pow( 1024, 7 ),
+ 1024 ** 7,
"1 ZB",
"1 zetabyte"
],
[
- pow( 1024, 8 ),
+ 1024 ** 8,
"1 YB",
"1 yottabyte"
],
"1 megabit per second"
],
[
- pow( 10, 9 ),
+ 10 ** 9,
"1 Gbps",
"1 gigabit per second"
],
[
- pow( 10, 12 ),
+ 10 ** 12,
"1 Tbps",
"1 terabit per second"
],
[
- pow( 10, 15 ),
+ 10 ** 15,
"1 Pbps",
"1 petabit per second"
],
[
- pow( 10, 18 ),
+ 10 ** 18,
"1 Ebps",
"1 exabit per second"
],
[
- pow( 10, 21 ),
+ 10 ** 21,
"1 Zbps",
"1 zetabit per second"
],
[
- pow( 10, 24 ),
+ 10 ** 24,
"1 Ybps",
"1 yottabit per second"
],
[
- pow( 10, 27 ),
+ 10 ** 27,
"1,000 Ybps",
"1,000 yottabits per second"
],